home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / Example_Code / SampleLibrary / test / clibtest.c < prev   
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.1 KB  |  48 lines

  1. /*
  2.  *  clibtest.c -- C example that calls the Sample.library functions
  3.  *
  4.  *  Copyright 1988 Commodore Amiga Inc.  All rights reserved.
  5.  *
  6.  *  Linkage Info:
  7.  *  FROM     Astartup.obj, clibtest.o
  8.  *  LIBRARY  LIB:amiga.lib, LIB:sample.lib
  9.  *  TO       CLibTest
  10.  */
  11.  
  12.  
  13. #include <exec/types.h>
  14. #include <exec/libraries.h>
  15. #include <libraries/dos.h>
  16.  
  17. #include "samplebase.h"
  18.  
  19. struct SampleBase *SampleBase;
  20.  
  21. void main()
  22.    {
  23.    LONG n;
  24.    struct Library *slib;
  25.  
  26.    /* Open sample.library */
  27.    if(!(SampleBase=(struct SampleBase *)OpenLibrary("sample.library",0)))
  28.       {
  29.       printf("Can't open sample.library\n");
  30.       exit(RETURN_FAIL);
  31.       }
  32.  
  33.    /* Print library name, version, revision */
  34.    slib = &SampleBase->LibNode;
  35.    printf("%s   Version %ld   Revision %ld\n",
  36.              slib->lib_Node.ln_Name, slib->lib_Version, slib->lib_Revision);
  37.  
  38.    /* Call the two functions */
  39.    n = Double(-7);
  40.    printf("Function Double(-7) returned %ld\n", n);
  41.  
  42.    n = AddThese(21,4);
  43.    printf("Function AddThese(21,4) returned %ld\n", n);
  44.  
  45.    CloseLibrary(SampleBase);
  46.    exit(RETURN_OK);
  47.    }
  48.